﻿#ifndef AGREEMENT_H
#define AGREEMENT_H

#include <QMap>
#include <QString>
#include <QStringList>
#include <QtMath>
#include "Console/tables.h"

//#include "Window/mainwindow.h"
#define ZTdata 6
#define MNdata 14
#define par_1  65025.0    ////计算参数
#define par_2  255.0     ////计算参数
 //#define STATE_BLACK "
enum Instruction  //指令
{
    CMD1=0,   //空闲查询
    CMD2,     //模拟量+状态量
    CMD3,     //关机
    CMD4,     //开机
};



struct FrameFormat   //帧格式
{
    quint16 HEAD;    //帧头
    quint8  LENGTH;  //长度
    quint8  DEVID;   //设备号
    quint8  CMD;     //指令
    quint8  DATA[16];//数据
    quint8  CRC;     //校验

};

void GetStateData(FrameFormat* format,State *state);//获取状态量

void JudgeData(Simulation *sim, FrameFormat* format, Equipment  *equ,State *state,int a=0);//判断

void GetSimulationData(Simulation *sim, FrameFormat* format,Equipment  *equ,int a);

float PowerAriIn(quint8 powHex,Equipment  *equ);//输出功率

float PowerAriRef(quint8 powHex,Equipment  *equ);//反射功率

float OtherAri(quint8 powHex,float coe);//其他数据

bool IsLittleEndian();
#endif // AGREEMENT_H
